﻿using System.Collections.Generic;
using Data;

namespace Controller {
    public class Controller {
        private static readonly DAO Dao = new DAO();

        public static int GetCommonValueId(string word) {
            return Dao.GetCommonValueId(word);
        }

        public static List<string> GetRelateWords(string word) {
            return Dao.GetRelateWords(word);
        }

        public static string GetRelateWord(int langId, string word) {
            return Dao.GetRelateWord(langId, word);
        }

        public static List<string> GetWords(int langId) {
            return Dao.GetWords(langId);
        }

        public static string GetCommonValueOf(string word) {
            return Dao.GetCommonValueOf(word);
        }

        public static string GetValueOf(string word) {
            return Dao.GetValueOf(word);
        }

        public static string GetRelateWord(string word) {
            //return _dao.GetRelateWord(word);
            return null;
        }

        public static string GetLangOf(string word) {
            return Dao.GetLangOf(word);
        }

        public static List<string> GetAllLanguages() {
            return Dao.GetAllLanguages();
        }

        #region update

        // return -1 if there is none of this word in the dictionary
        // return 0 if it's OK
        // return 1 if there is a word already in dictionary
        public static int UpdateWord(string oldWord, string newWord) {
            return Dao.ChangeWord(oldWord, newWord);
        }

        public static void DisableWord(string word) {
            Dao.DisableWord(word);
        }

        public static bool UpdateValue(string oldWord, string newWord, string value, string commonValue) {
            return Dao.UpdateValue(oldWord, newWord, value, commonValue);
        }

        #endregion

        #region Insert

        public static int InsertWord(string word, string commonValue, int comValueId, string specValue, int langId) {
            return Dao.InsertWord(word, commonValue, comValueId, specValue, langId);
        }

        #endregion
    }
}